<template>
  <div class="data-three" ref="three"></div>
</template>

<script>
import { kefuData } from "../network/api/api";
const echarts = require("echarts");
export default {
  name: "DataThree",
  data() {
    return {
      threeData: {},
    };
  },
  methods: {
    getThreeData() {
      kefuData().then((res) => {
        console.log(res);
        this.threeData = res.data;
        this.echartsInit();
      });
    },
    echartsInit() {
      const my_echarts = echarts.init(this.$refs.three);
      let options = {
        title: {
          text: "客服录入量统计",
          left: "center",
        },
        toolbox: {
          feature: {
            saveAsImage: {},
          },
        },
        xAxis: {
          type: "category",
          data: this.threeData.kefu,
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            data:this.threeData.num,
            type: "bar",
          },
        ],
      };
      my_echarts.setOption(options);
    },
  },
  mounted() {
    this.getThreeData();
  },
};
</script>

<style lang="less" scoped>
.data-three{
  width: 100%;
  height: 700px;
  padding-bottom:300px ;
}
</style>